using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;

public class LaunchUIController : MonoBehaviour
{
	private static LaunchUIController m_Instance;

	public bool unlockAllLevels;

	public bool infinitePower;

	[SerializeField]
	private GridLayoutGroup m_ChapterRoot;

	private List<ChapterCities> m_ChapterCities;

	[SerializeField]
	private ScrollRectSnapElement m_ChapterSnapElement;

	[SerializeField]
	private GridLayoutGroup m_LevelRoot;

	private ScrollRectSnapElement m_LevelSnap2Element;

	private Animator m_Animator;

	[SerializeField]
	private Animator m_AchieveAnimator;

	[SerializeField]
	private Image m_RiseMask;

	[SerializeField]
	private Image m_FadeMask;

	[SerializeField]
	private GameObject m_LoadingFlag;

	[SerializeField]
	private GameObject m_Blank;

	[SerializeField]
	private Text m_Physical;

	[SerializeField]
	private NumericalEffect m_chipText;

	[SerializeField]
	private Image m_PhysicalBar;

	[SerializeField]
	private Text m_PhysicalCooldownText;

	private ChapterLevel m_ChapterLevelPrefab;

	[SerializeField]
	private Image m_ChapterTitle;

	[SerializeField]
	private GameObject m_WatchADButton;

	[SerializeField]
	private Text m_WatchAdBtnCooldown;

	[SerializeField]
	private Animator m_WatchAdMaskAnim;

	private bool m_CanPlayVedio;

	[SerializeField]
	private GameObject m_DevAdSwitchButton;

	private bool m_DevAdSwitchButtonVisible;

	[SerializeField]
	private CountdownText m_CountdownText;

	[SerializeField]
	private GameObject m_LaunchMask;

	[SerializeField]
	private RectTransform m_LevelPanel1;

	[SerializeField]
	private RectTransform m_LevelPanel2;

	[SerializeField]
	private GameObject battleLevelGrid;

	[SerializeField]
	private GameObject achievePanelGO;

	[SerializeField]
	private GameObject rankPanelGO;

	[SerializeField]
	private GameObject lucklyPanelGO;

	[SerializeField]
	private GameObject ahieveTipIcon;

	[SerializeField]
	private GameObject luckyTipIcon;

	public Sprite[] spriteIcons;

	public GameObject activityPanelGO;

	public GameObject activityBtn;

	public Text activityBtnText;

	public GameObject activityTip;

	public GameObject shopCanvas;

	private bool _isOpenLuckyPanel;

	private bool _clickBattle;

	public static LaunchUIController instance => m_Instance;

	public GameObject luckyPanel
	{
		get;
		set;
	}

	public static void SetPhysical(int value)
	{
		if ((bool)m_Instance)
		{
			value = Mathf.Max(0, value);
			m_Instance.m_Physical.text = value.ToString() + "/" + 20;
			m_Instance.m_PhysicalBar.fillAmount = (float)value / 20f;
		}
	}

	private void Awake()
	{
		m_Animator = GetComponent<Animator>();
		GameManager.GType = GameType.None;
		GameManager.CurrentUIRoot = GetComponent<Canvas>();
		m_Instance = this;
		m_Blank.SetActive(value: false);
		m_RiseMask.gameObject.SetActive(value: false);
		m_LaunchMask.SetActive(value: false);
		m_LoadingFlag.SetActive(value: true);
		m_ChapterLevelPrefab = m_LevelRoot.transform.parent.GetChild(0).GetComponent<ChapterLevel>();
		m_ChapterLevelPrefab.transform.SetParent(base.transform);
		m_ChapterLevelPrefab.gameObject.SetActive(value: false);
		m_LevelSnap2Element = m_LevelRoot.transform.parent.GetComponent<ScrollRectSnapElement>();
		for (int i = 0; i < 10; i++)
		{
			SupportTools.AddChild<ChapterLevel>(m_LevelPanel1.gameObject, m_ChapterLevelPrefab.gameObject).gameObject.SetActive(value: true);
			SupportTools.AddChild<ChapterLevel>(m_LevelPanel2.gameObject, m_ChapterLevelPrefab.gameObject).gameObject.SetActive(value: true);
		}
		for (int j = 0; j < BattleInfoMgr.battleInfos.Count; j++)
		{
			BattleInfo battleInfo = BattleInfoMgr.battleInfos[j];
			UnityEngine.Object original = Resources.Load("AIPlayerItem");
			GameObject gameObject = UnityEngine.Object.Instantiate(original) as GameObject;
			gameObject.transform.parent = battleLevelGrid.transform;
			gameObject.transform.localScale = Vector3.one;
			UIAIPlayerItem component = gameObject.GetComponent<UIAIPlayerItem>();
			component.SetFee(battleInfo.fee);
			component.name.text = battleInfo.name;
			component.chips.text = battleInfo.chips + string.Empty;
			component.battleInfo = battleInfo;
			component.onClick = OnClickAIPlayerItem;
			component.headerIcon.sprite = GetSpriteFromName("Title_" + battleInfo.name);
			component.scrollRect = battleLevelGrid.transform.parent.GetComponent<ScrollRect>();
			if (BattleInfoMgr.IsLock(battleInfo.id))
			{
				component.Lock();
			}
			else
			{
				component.Unlock();
			}
		}
		if (string.IsNullOrEmpty(ConstantData.BattleSceneType))
		{
			m_Animator.Play("Loading");
			Invoke("LoadingDone", 1f);
			return;
		}
		m_Animator.SetTrigger(ConstantData.BattleSceneType);
		if (ConstantData.BattleSceneType.CompareTo("ToLevel") == 0)
		{
			LoadLevelWithChapter(ConstantData.LoadedChapter);
		}
	}

	private void LoadingDone()
	{
		m_Animator.SetBool("GameStart", value: true);
		m_Animator.SetTrigger("ToMain");
		m_LoadingFlag.SetActive(value: false);
		m_Blank.SetActive(value: true);
		if (!EternalNode.Instance.IsTheSameDay() && DayRecord.instance.TodayGet(DayRecordKey.FREE_DRAW) == 0)
		{
			OpenLucklyPanel();
		}
	}

	private void OnRefreshChips()
	{
		m_chipText.value = ConstantData.chips;
	}

	private void OnClickAIPlayerItem(BattleInfo info)
	{
		if (ConstantData.chips >= info.fee)
		{
			AIPlayer.curBattleInfo = info;
			LoadBattleWithBatleInfo(info);
			ConstantData.chips -= info.fee;
		}
		/* else if (AdManagerOld.instance.curAd.HasVideo())
		{
			UIADViewWnd.Show(UIADViewWnd.ADViewType.NotEnough);
		} */
		else
		{
			UIADViewWnd.ShowTip("筹码不足！");//HOLocalizationConfiguration.GetValue(179));
		}
	}

	private void AdjustBattlePosition()
	{
		ScrollRectSnapElement component = battleLevelGrid.transform.parent.GetComponent<ScrollRectSnapElement>();
		component.Snap2Element(0);
	}

	private void Start()
	{
		ahieveTipIcon.SetActive(CanTakeAchieveReward());
		if (infinitePower)
		{
			ConstantData.physical = 20;
		}
		else
		{
			SetPhysical(ConstantData.physical);
		}
		m_chipText.InitValue(ConstantData.chips);
		ConstantData.onChangeChips = (Action)Delegate.Combine(ConstantData.onChangeChips, new Action(OnRefreshChips));
		CheckADVedioReady();
		ChapterCities component = m_ChapterRoot.transform.GetChild(0).GetComponent<ChapterCities>();
		component.transform.SetParent(null);
		int num = 0;
		m_ChapterCities = new List<ChapterCities>();
		var items = ChapterConfiguration.chapterDictionary.OrderBy(value => value.Value.chapter).ToArray();
		foreach (KeyValuePair<int, ChapterInfo> item in items)
		{
			num++;
			ChapterInfo value = item.Value;
			ChapterCities chapterCities = SupportTools.AddChild<ChapterCities>(m_ChapterRoot.gameObject, component.gameObject);
			chapterCities.text.text = value.name;
			chapterCities.name = value.imageName.Substring(6);
			chapterCities.chapter = value.chapter;
			Sprite sprite = Resources.Load<Sprite>("UI/LaunchScene/MissionCards/" + value.imageName);
			Sprite sprite2 = Resources.Load<Sprite>("UI/LaunchScene/ChapterTitle/" + value.titleName);
			if ((bool)sprite)
			{
				chapterCities.image.sprite = sprite;
			}
			if ((bool)sprite2)
			{
				chapterCities.title.sprite = sprite2;
			}
			LayoutInfoKey key = LayoutInfoKey.GenerateKey(value.chapter, 1);
			bool flag = LayoutConfiguration.cardDictionary[key].OpenStar > ConstantData.missionRecords.GetTotalStar();
			if (unlockAllLevels)
			{
				chapterCities.lockMask.SetActive(value: false);
			}
			else
			{
				chapterCities.lockMask.SetActive(flag);
			}
			int num2 = 0;
			if (!flag)
			{
				num2 = ConstantData.missionRecords.GetChapterStars(item.Key);
				ConstantData.missionRecords.RecordOpenLevel(item.Key, 1);
			}
			chapterCities.process.text = string.Format(HOLocalizationConfiguration.GetValue(104), num2, 60);
			m_ChapterCities.Add(chapterCities);
		}
		UnityEngine.Object.Destroy(component.gameObject);
		RectTransform component2 = m_ChapterRoot.GetComponent<RectTransform>();
		float num3 = num;
		Vector2 cellSize = m_ChapterRoot.cellSize;
		float num4 = num3 * cellSize.x;
		float num5 = num;
		Vector2 spacing = m_ChapterRoot.spacing;
		float x = num4 + num5 * spacing.x;
		Vector2 cellSize2 = m_ChapterRoot.cellSize;
		component2.sizeDelta = new Vector2(x, cellSize2.y);
		m_ChapterSnapElement.Initialize();
		ScrollRectSnapElement chapterSnapElement = m_ChapterSnapElement;
		chapterSnapElement.onSnapElementObjectEnable = (Action)Delegate.Combine(chapterSnapElement.onSnapElementObjectEnable, new Action(SnapToSpecifiedChapter));
		ScrollRectSnapElement chapterSnapElement2 = m_ChapterSnapElement;
		chapterSnapElement2.onSnapElementComplete = (Action<RectTransform>)Delegate.Combine(chapterSnapElement2.onSnapElementComplete, new Action<RectTransform>(OnChpaterCitiesSnapDone));
		RefreshLuckyTip();
		RefreshActivityTip();
		ActivityManager.instance.ReOpen();
	}

	private void Update()
	{
		if (UnityEngine.Input.GetKeyDown(KeyCode.Escape))
		{
			GameObject gameObject = GameObject.Find("BackButton");
			if (gameObject != null)
			{
				MultiImageButton component = gameObject.GetComponent<MultiImageButton>();
				if (component != null && component.onClick != null)
				{
					component.onClick.Invoke();
					return;
				}
			}
			if ((bool)base.transform.Find("TextDialog"))
			{
				base.transform.GetChild(base.transform.childCount - 1).GetComponent<TextDialog>().OnCancel();
			}
			else if (m_AchieveAnimator.GetCurrentAnimatorStateInfo(0).IsName("Show"))
			{
				m_AchieveAnimator.SetTrigger("Hide");
			}
			else
			{
				AnimatorStateInfo currentAnimatorStateInfo = m_Animator.GetCurrentAnimatorStateInfo(0);
				if (currentAnimatorStateInfo.IsName("LevelLoop") || currentAnimatorStateInfo.IsName("MissionToLevel"))
				{
					m_Animator.SetTrigger("ToMission");
				}
				else if (!currentAnimatorStateInfo.IsName("Start") && !currentAnimatorStateInfo.IsName("GameTitle") && !currentAnimatorStateInfo.IsName("TitleToMain") && !currentAnimatorStateInfo.IsName("Loading") && !currentAnimatorStateInfo.IsName("MainLoop"))
				{
					m_Animator.SetTrigger("ToMain");
					AdManagerOld.instance.curAd.HideBanner();
				}
				else if (currentAnimatorStateInfo.IsName("MainLoop"))
				{
					Quit();
				}
			}
		}
		if (Time.frameCount % 60 == 0)
		{
			CheckADVedioReady();
			ahieveTipIcon.SetActive(CanTakeAchieveReward());
		}
		if (ConstantData.physical < 20)
		{
			m_PhysicalCooldownText.gameObject.SetActive(value: true);
			m_PhysicalCooldownText.text = EternalNode.Instance.physicalRecoverTime;
		}
		else
		{
			m_PhysicalCooldownText.gameObject.SetActive(value: false);
			m_PhysicalCooldownText.text = EternalNode.Instance.physicalRecoverTimeFull;
		}
		if (PlayerPrefs.HasKey("bie_key") && ActivityManager.instance.GetLeftTime() > 0)
		{
			activityBtn.SetActive(value: true);
			activityBtnText.text = "挑战！\n" + ActivityManager.instance.GetLeftTimeDesc();
		}
		else
		{
			activityBtn.SetActive(value: false);
		}
	}

	private void Quit()
	{
		UnityEngine.Debug.Log("Quit");
		AdManagerOld.instance.curAd.ShowExit();
	}

	public void CheckADVedioReady()
	{
	}

	private void OnDestroy()
	{
		m_Instance = null;
		AdManagerOld.instance.curAd.HideBanner();
		GameStatistics.Serialize();
		ScrollRectSnapElement chapterSnapElement = m_ChapterSnapElement;
		chapterSnapElement.onSnapElementComplete = (Action<RectTransform>)Delegate.Remove(chapterSnapElement.onSnapElementComplete, new Action<RectTransform>(OnChpaterCitiesSnapDone));
		ConstantData.onChangeChips = (Action)Delegate.Remove(ConstantData.onChangeChips, new Action(OnRefreshChips));
	}

	private void SnapToSpecifiedChapter()
	{
		ScrollRectSnapElement chapterSnapElement = m_ChapterSnapElement;
		chapterSnapElement.onSnapElementObjectEnable = (Action)Delegate.Remove(chapterSnapElement.onSnapElementObjectEnable, new Action(SnapToSpecifiedChapter));
		if (ConstantData.LoadedChapter != 0)
		{
			m_ChapterSnapElement.Snap2Element(ConstantData.LoadedChapter - 1);
		}
	}

	public void OnMoreGameClick()
	{
		AdManagerOld.instance.curAd.ShowMore();
	}

	public void PlayVedioButtonClick()
	{
		UIADViewWnd.Show(UIADViewWnd.ADViewType.Video);
		//AdManagerOld.instance.curAd.ShowBanner(QiXunAd.TOP);
	}

	private void WatchAdBtnDialogCallback()
	{
		EternalNode.Instance.StartAdBtnRecover();
		AdManagerOld.instance.PlayVideo(1, delegate
		{
			EternalNode.Instance.SendMessage("VedioPlayedCallback_Launch");
		});
		CheckADVedioReady();
	}

	public void LoadQuickFire()
	{
		GameManager.GType = GameType.QuickFire;
		ConstantData.BattleSceneType = "ToPratice";
		LoadScene(2);
	}

	public void LoadStandard()
	{
		GameManager.GType = GameType.Standard;
		ConstantData.BattleSceneType = "ToPratice";
		LoadScene(2);
	}

	public void LoadBattleWithVeryLowAI()
	{
		LoadBattleWithAI(AIDifficulty.VeryLow);
	}

	public void LoadBattleWithLowAI()
	{
		LoadBattleWithAI(AIDifficulty.Low);
	}

	public void LoadBattleWithMediumAI()
	{
		LoadBattleWithAI(AIDifficulty.Medium);
	}

	private void LoadBattleWithAI(AIDifficulty difficulty)
	{
		AIPlayer.difficulty = difficulty;
		GameManager.GType = GameType.AI;
		ConstantData.BattleSceneType = "ToAI";
		LoadScene(2);
	}

	private void LoadBattleWithBatleInfo(BattleInfo info)
	{
		AIPlayer.degreeOffset = ((info.id >= 3) ? info.degree : ((float)UnityEngine.Random.Range(2, 5) / 100f));
		AIPlayer.canReboundHit = info.hookBall;
		AIPlayer.canReboundPocket = info.canReboundInBag;
		GameManager.GType = GameType.AI;
		ConstantData.BattleSceneType = "ToAI";
		LoadScene(2);
	}

	private void Snap2ElementChapterCities()
	{
		m_ChapterSnapElement.Snap2Element(ConstantData.LoadedChapter - 1);
	}

	private void OnChpaterCitiesSnapDone(RectTransform rect)
	{
		ConstantData.LoadedChapter = rect.GetComponent<ChapterCities>().chapter;
	}

	private void LoadLevelWithChapter(int chapter)
	{
		if (ConstantData.LoadedChapter != chapter)
		{
			ConstantData.LoadedChapter = chapter;
			Invoke("Snap2ElementChapterCities", 0.1f);
			return;
		}
		int childCount = m_LevelRoot.transform.childCount;
		IList<LevelData> list = ConstantData.LevelDatas.DumpLevelDatasWithChapter(chapter);
		int i;
		for (i = 0; i < 10; i++)
		{
			AddLevelNode(list[i], m_LevelPanel1, i);
		}
		int num = i;
		while (num < m_LevelPanel1.childCount)
		{
			m_LevelPanel1.GetChild(num++).gameObject.SetActive(value: false);
		}
		for (i = 0; i < list.Count - 10; i++)
		{
			AddLevelNode(list[i + 10], m_LevelPanel2, i);
		}
		num = i;
		while (num < childCount)
		{
			m_LevelRoot.transform.GetChild(num++).gameObject.SetActive(value: false);
		}
		RectTransform component = m_LevelRoot.GetComponent<RectTransform>();
		Vector2 cellSize = m_LevelRoot.cellSize;
		float num4 = 2f * cellSize.x;
		Vector2 spacing = m_LevelRoot.spacing;
		float x = num4 + 1f * spacing.x;
		Vector2 cellSize2 = m_LevelRoot.cellSize;
		component.sizeDelta = new Vector2(x, cellSize2.y);
		m_LevelSnap2Element.Initialize();
		int levelTraceInt = ConstantData.LevelDatas.GetLevelTraceInt(chapter);
		m_LevelSnap2Element.Snap2Element((levelTraceInt > 10) ? 1 : 0);
		if (m_ChapterCities != null && m_ChapterCities.Count != 0)
		{
			m_ChapterTitle.sprite = m_ChapterCities[chapter - 1].title.sprite;
		}
		else
		{
			m_ChapterTitle.sprite = Resources.Load<Sprite>("UI/LaunchScene/ChapterTitle/" + ChapterConfiguration.chapterDictionary[chapter].titleName);
		}
		m_Animator.SetTrigger("ToLevel");
	}

	private void AddLevelNode(LevelData levelData, Transform parent, int i)
	{
		int childCount = parent.transform.childCount;
		ChapterLevel chapterLevel = (i >= childCount) ? SupportTools.AddChild<ChapterLevel>(parent.gameObject, m_ChapterLevelPrefab.gameObject) : parent.GetChild(i).GetComponent<ChapterLevel>();
		chapterLevel.gameObject.SetActive(value: true);
		chapterLevel.levelData = levelData;
		chapterLevel.text.text = levelData.FileName.Split('-')[1];
		chapterLevel.name = "Level-" + chapterLevel.text.text;
		chapterLevel.SetStar(ConstantData.missionRecords.GetStar(levelData.FileName));
		chapterLevel.physicalText.text = LayoutConfiguration.instance[levelData.FileName].PhysicalStrengh.ToString();
		int chapter = ConstantData.LevelDatas.GetChapter(levelData.FileName);
		int level = ConstantData.LevelDatas.GetLevel(levelData.FileName);
		bool flag = level > ConstantData.missionRecords.GetOpenLevel(chapter);
		if (unlockAllLevels)
		{
			chapterLevel.mask.SetActive(value: false);
			chapterLevel.physicalText.transform.parent.gameObject.SetActive(value: true);
		}
		else
		{
			chapterLevel.mask.SetActive(flag);
			chapterLevel.physicalText.transform.parent.gameObject.SetActive(!flag);
			chapterLevel.lockIcon.gameObject.SetActive(flag);
		}
	}

	public void LoadLevel(GameObject go)
	{
		ChapterCities component = go.GetComponent<ChapterCities>();
		LoadLevelWithChapter(component.chapter);
	}

	public void GoMisstion(ChapterLevel l)
	{
		UnityEngine.Debug.Log("Go mission");
		if (ConstantData.physical < LayoutConfiguration.instance[l.levelData.FileName].PhysicalStrengh)
		{
			TextDialog.Show(HOLocalizationConfiguration.GetValue(340));
			return;
		}
		LevelDataIndex.CurrentLevel = l.levelData;
		GameManager.GType = GameType.Mission;
		EnterLevel();
	}

	public void EnterLevel()
	{
		int physicalStrengh = LayoutConfiguration.instance[LevelDataIndex.CurrentLevel.FileName].PhysicalStrengh;
		if (physicalStrengh > 0)
		{
			ConstantData.physical -= physicalStrengh;
			m_CountdownText.Show(physicalStrengh);
			CountdownText countdownText = m_CountdownText;
			countdownText.onFinish = (Delegate0Args)Delegate.Combine(countdownText.onFinish, new Delegate0Args(OnCountdownShowFinish));
			m_LaunchMask.SetActive(value: true);
        }
		else
		{
			OnCountdownShowFinish();
		}
	}

	private void OnCountdownShowFinish()
	{
		UnityEngine.Debug.Log("On count down finish");
		CountdownText countdownText = m_CountdownText;
		countdownText.onFinish = (Delegate0Args)Delegate.Remove(countdownText.onFinish, new Delegate0Args(OnCountdownShowFinish));
		ConstantData.LevelDatas.TracingLevel(LevelDataIndex.CurrentLevel.FileName);
		GameManager.GType = GameType.Mission;
		ConstantData.BattleSceneType = "ToLevel";
		LoadScene(2);
	}

	public void LoadScene(int sceneIndex)
	{
		UnityEngine.Debug.Log("Load scene");
		m_RiseMask.gameObject.SetActive(value: true);
		AudioManager.StopBGM();
		m_RiseMask.GetComponent<AnimationTools>().sceneIndex = 2;
		//AdManagerOld.instance.curAd.HideBanner();
		if (ConstantData.onMaskRiseup != null)
		{
			ConstantData.onMaskRiseup();
		}
	}

	public void OpenShop()
	{
		AdManagerOld.instance.curAd.ShowBanner(QiXunAd.BOTTOM);
		shopCanvas.SetActive(value: false);
		shopCanvas.SetActive(value: true);
		UIShopPanel component = shopCanvas.GetComponent<UIShopPanel>();
		UIShopItem[] componentsInChildren = shopCanvas.GetComponentsInChildren<UIShopItem>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			UIShopItem uIShopItem = componentsInChildren[i];
			if (i < ShopInfoMgr.shopInfos.Count)
			{
				ShopInfo shopInfo = ShopInfoMgr.shopInfos[i];
				uIShopItem.parentPanel = component;
				uIShopItem.shopInfo = shopInfo;
			}
		}
	}

	public void OpenAchieve()
	{
		achievePanelGO.SetActive(value: false);
		achievePanelGO.SetActive(value: true);
		AdManagerOld.instance.curAd.ShowBanner(QiXunAd.BOTTOM);
	}

	public void OpenRank()
	{
		rankPanelGO.SetActive(value: false);
		rankPanelGO.SetActive(value: true);
		AdManagerOld.instance.curAd.ShowBanner(QiXunAd.BOTTOM);
	}

	public void OpenLucklyPanel()
	{
		if (!luckyPanel.activeSelf)
		{
			luckyPanel.SetActive(value: true);
		}
		else
		{
			luckyPanel.GetComponentInChildren<AnimationTools>().Trigger("Show");
		}
		luckyPanel.GetComponentInChildren<UILucky>().ShowArrow();
		//AdManagerOld.instance.curAd.ShowBanner(QiXunAd.BOTTOM);
		if (!AdManager1.instance.ShieldAddress)
		{
			AdManager.single.ShowNative();
		}
	}

	public void OpenActivityPanel()
	{
		activityPanelGO.SetActive(value: true);
	}

	public void RefreshLuckyTip()
	{
		int num = DayRecord.instance.TodayGet(DayRecordKey.FREE_DRAW);
		int dayFreeDrawCount = CommonConfig.CommonCfgInfo.dayFreeDrawCount;
		if (num < dayFreeDrawCount)
		{
			luckyTipIcon.SetActive(value: true);
		}
		else
		{
			luckyTipIcon.SetActive(value: false);
		}
	}

	public void RefreshActivityTip()
	{
		activityTip.SetActive(ActivityManager.instance.HavePrize());
	}

	public void ClickBattle()
	{
		_clickBattle = true;
		AdManagerOld.instance.curAd.ShowBanner(QiXunAd.BOTTOM);
	}

	public void ClickMission()
	{
		if (!NewBie.instance.enable)
		{
			AdManagerOld.instance.curAd.ShowBanner(QiXunAd.BOTTOM);
			m_Animator.SetTrigger("ToMission");
		}
	}

	public Sprite GetSpriteFromName(string name)
	{
		for (int i = 0; i < spriteIcons.Length; i++)
		{
			if (spriteIcons[i].name.Equals(name))
			{
				return spriteIcons[i];
			}
		}
		return null;
	}

	private bool CanTakeAchieveReward()
	{
		Dictionary<int, AchieveInfo>.Enumerator enumerator = AchieveConfiguration.achieveDictionary.GetEnumerator();
		while (enumerator.MoveNext())
		{
			int key = enumerator.Current.Key;
			if (ConstantData.achieveRecords[key] >= enumerator.Current.Value.goal && enumerator.Current.Value.prizeItemId > 0 && !ConstantData.achieveRecords.IsTakenReward(key))
			{
				return true;
			}
		}
		return false;
	}

	public void Hide()
	{
		transform.Find("PrivacyPanel").gameObject.SetActive(true);
	}
}
